/*RUKQ7yF3RNKqie1Y0AQyAQK/GQAb2y0+ZkNsh2qgy7gBaGhyY5JXr7NuQweqaOfT*/
/*
 * @Author: chaiwx 
 * @PageInfo: 编辑前同步ajax请求
 * @Date: 2018-06-14 15:24:52 
 * @Last Modified by: chaiwx
 * @Last Modified time: 2018-10-24 10:31:06
 */
import { ajax, toast } from 'nc-lightapp-front';

export default async function(url, data) {
	return new Promise(function(resolve, reject) {
		ajax({
			url: url,
			data: data,
			success: (res) => {
				if (res.data) {
					let editFlag = res.data.isedit;
					if (editFlag) {
						resolve(editFlag);
					} else if (res.data.message) {
						toast({
							color: 'warning',
							content: res.data.message
						});
					}
					resolve(false);
				}
			},
			error: (error) => {
				toast({
					color: 'warning',
					content: error.message
				});
				resolve(false);
			}
		});
	});
}

/*RUKQ7yF3RNKqie1Y0AQyAQK/GQAb2y0+ZkNsh2qgy7gBaGhyY5JXr7NuQweqaOfT*/